package com.jrx.anytxn.param.job.investor.investorLimit.step;

import com.jrx.anytxn.param.entity.PrInvestorLimit;
import com.jrx.anytxn.param.mapper.ext.ExtPrInvestorLimitMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.batch.item.ItemWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 出资方额度更新 - writer
 * 
 * @author liuyang
 * @date 2020-06-01
 */
@Service
public class InvestorLimitWriter implements ItemWriter<PrInvestorLimit> {

    @Autowired
    private ExtPrInvestorLimitMapper extPrInvestorLimitMapper;
    
    @Override
    public void write(List<? extends PrInvestorLimit> items) {

        if(CollectionUtils.isNotEmpty(items)) {
            extPrInvestorLimitMapper.batchUpdateInvestorLimitForBatch((List<PrInvestorLimit>) items);
        }
        
    }
}
